<template>
  <modal-box :show="show" @close="$emit('close')">
    <div class="menu-modal">
      <h2>{{menuName}}的用料</h2>
      <input type="text" placeholder="输入用料名" v-model.trim="name">
      <input type="text" placeholder="输入数目备注等" v-model.trim="info">
      <button @click="save">保存</button>
    </div>
  </modal-box>
</template>

<script>
import ModalBox from "./ModalBox.vue";
export default {
  components: { ModalBox },
  props: {
    show: {
      type: Boolean,
      default: false,
    },
    menuName: {
      type: String,
      required: true,
      // default: ''
    }
  },
  data() {
    return {
      name: '', // 用料名称
      info: ''
    }
  },
  methods: {
    save() {
      this.$emit('add-item', {name: this.name, info: this.info});
      // this.name = '';
      // this.info = '';
    }
  }
};
</script>
